
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>基础绘图 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="05.html" />
    
    
    <link rel="prev" href="03.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="./">
            
                <a href="./">
            
                    
                    简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="01.html">
            
                <a href="01.html">
            
                    
                    本书参考
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="02.html">
            
                <a href="02.html">
            
                    
                    基础操作与矩阵输入
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="03.html">
            
                <a href="03.html">
            
                    
                    结构化程式与自定函数
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.5" data-path="04.html">
            
                <a href="04.html">
            
                    
                    基础绘图
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="05.html">
            
                <a href="05.html">
            
                    
                    数值微积分
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="." >基础绘图</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <p><strong>&#x57FA;&#x7840;&#x7ED8;&#x56FE;</strong></p>
<hr>
<p>&#x70B9;&#x52A8;&#x6210;&#x7EBF;&#xFF0C;&#x7EBF;&#x52A8;&#x6210;&#x9762;</p>
<hr>
<p>&#x547D;&#x4EE4;&#xFF1A;plot(2,3)</p>
<p>&#x753B;&#x4E00;&#x4E2A;&#x70B9;</p>
<hr>
<p>&#x547D;&#x4EE4;&#xFF1A;plot(cos(0:pi/20:2*pi))</p>
<p>&#x7ED8;&#x5236;&#x4E00;&#x6761;&#x66F2;&#x7EBF;</p>
<p><img src="img/4-1.jpg" alt=""></p>
<hr>
<p>&#x547D;&#x4EE4;&#xFF1A;</p>
<p>hold on
plot(cos(0:pi/20:2<em>pi));
plot(sin(0:pi/20:2</em>pi));
hold off</p>
<p>&#x6CE8;&#xFF1A;&#x7531;&#x4E8E;&#x8F6F;&#x4EF6;&#x4F1A;&#x6E05;&#x9664;&#x4E0A;&#x4E00;&#x5F20;&#x56FE;&#x50CF;&#xFF0C;&#x5982;&#x679C;&#x60F3;&#x540C;&#x65F6;&#x663E;&#x793A;&#x4E24;&#x4E2A;plot&#xFF0C;&#x9700;&#x8981;&#x52A0;&#x4E0A;hold on/off &#x754C;&#x5B9A;&#x3002;</p>
<p><img src="img/4-2.jpg" alt=""></p>
<hr>
<p><strong>Plot Style &#xFF08;&#x70B9;&#x7684;&#x6837;&#x5F0F;&#xFF09;</strong></p>
<p>&#x4E3A;&#x4E86;&#x533A;&#x522B;&#x4E0D;&#x540C;&#x7684;&#x66F2;&#x7EBF;&#xFF0C;&#x66F4;&#x76F4;&#x89C2;&#x5316;&#xFF0C;&#x9700;&#x8981;&#x4F7F;&#x7528;&#x4E0D;&#x540C;&#x7684;&#x6837;&#x5F0F;</p>
<table>
<thead>
<tr>
<th>Data markers &#xFF08;&#x6807;&#x8BB0;&#x6837;&#x5F0F;&#xFF09;</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>Dot (.)</td>
<td>.</td>
</tr>
<tr>
<td>Asterisk (*)</td>
<td>*</td>
</tr>
<tr>
<td>Cross (&#xD7;)</td>
<td>X</td>
</tr>
<tr>
<td>Circle (&#x25CB;)</td>
<td>o</td>
</tr>
<tr>
<td>Plus sign (+)</td>
<td>+</td>
</tr>
<tr>
<td>Square (&#x25A1;)</td>
<td>s</td>
</tr>
<tr>
<td>Diamond (&#x25C7;)</td>
<td>d</td>
</tr>
<tr>
<td>Five-pointed star (&#x2606;)</td>
<td>p</td>
</tr>
<tr>
<td>Triangle (down &#x2207;)</td>
<td>v</td>
</tr>
<tr>
<td>Triangle (up &#x394;)</td>
<td>^</td>
</tr>
<tr>
<td>Triangle (left &#x25C1;)</td>
<td>&lt;</td>
</tr>
<tr>
<td>Triangle (right &#x25B7;)</td>
<td>&gt;</td>
</tr>
<tr>
<td>hexagram</td>
<td>H</td>
</tr>
<tr>
<td></td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>Line types &#xFF08;&#x7EBF;&#x6761;&#x6837;&#x5F0F;&#xFF09;</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>Solid line</td>
<td>-</td>
</tr>
<tr>
<td>Dashed line</td>
<td>--</td>
</tr>
<tr>
<td>Dash-dotted line</td>
<td>-.</td>
</tr>
<tr>
<td>Dotted line</td>
<td>:</td>
</tr>
<tr>
<td></td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>Colors &#xFF08;&#x989C;&#x8272;&#xFF09;</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>Black</td>
<td>k</td>
</tr>
<tr>
<td>Blue</td>
<td>b</td>
</tr>
<tr>
<td>Cyan</td>
<td>c</td>
</tr>
<tr>
<td>Green</td>
<td>g</td>
</tr>
<tr>
<td>Magenta</td>
<td>m</td>
</tr>
<tr>
<td>Red</td>
<td>r</td>
</tr>
<tr>
<td>White</td>
<td>w</td>
</tr>
<tr>
<td>Yellow</td>
<td>y</td>
</tr>
<tr>
<td></td>
</tr>
</tbody>
</table>
<hr>
<p><strong>&#x4E3E;&#x4F8B;</strong></p>
<p>&#x683C;&#x5F0F;&#xFF1A; plot(x,y,&apos;str&apos;) </p>
<p>&#x547D;&#x4EE4;&#xFF1A;plot(cos(0:pi/20:2<em>pi),&apos;</em>:g&apos;) </p>
<p><img src="img/4-3.jpg" alt=""></p>
<p>&#x6CE8;&#xFF1A;&#x5F88;&#x6F02;&#x4EAE;&#x54D2;~</p>
<hr>
<p><strong>&#x7ED8;&#x5236;&#x56FE;&#x4F8B;</strong></p>
<p>&#x683C;&#x5F0F;&#xFF1A;legend(&apos;L1&apos;,...)</p>
<p>&#x547D;&#x4EE4;&#xFF1A;</p>
<p>x=0:0.5:4<em>pi;
y=sin(x); h=cos(x); w=1./(1+exp(-x));
g=(1/(2</em>pi<em>2)^0.5).</em>exp((-1.<em>(x-2</em>pi).^2)./(2*2^2));
plot(x,y,&apos;bd-&apos;,x,h,&apos;gp:&apos;,x,w,&apos;ro-&apos;,x,g,&apos;c^-&apos;);
legend(&apos;sin(x)&apos;,&apos;cos(x)&apos;,&apos;Sigmoid&apos;,&apos;Gauss function&apos;);</p>
<p><img src="img/4-4.jpg" alt=""></p>
<p>&#x6CE8;&#xFF1A;&#x8FD9;&#x4E2A;&#x66F4;&#x6F02;&#x4EAE;&#x5466;&#xFF01;</p>
<hr>
<p><strong>&#x7ED8;&#x5236;&#x6807;&#x9898;&#x548C;&#x5750;&#x6807;&#x8F74;</strong></p>
<p>&#x683C;&#x5F0F;&#xFF1A;</p>
<table>
<thead>
<tr>
<th>title()</th>
<th>&#x6807;&#x9898;</th>
</tr>
</thead>
<tbody>
<tr>
<td>xlabel()</td>
<td>x&#x8F74;</td>
</tr>
<tr>
<td>ylabel()</td>
<td>y&#x8F74;</td>
</tr>
</tbody>
</table>
<p>&#x547D;&#x4EE4;&#xFF1A;</p>
<p>x = 0:0.1:2<em>pi; y1 = sin(x); y2 = exp(-x);
plot(x, y1, &apos;--</em>&apos;, x, y2, &apos;:o&apos;);
xlabel(&apos;t = 0 to 2\pi&apos;);
ylabel(&apos;values of sin(t) and e^{-x}&apos;)
title(&apos;Function Plots of sin(t) and e^{-x}&apos;);
legend(&apos;sin(t)&apos;,&apos;e^{-x}&apos;);</p>
<p><img src="img/4-5.jpg" alt=""></p>
<p>&#x6CE8;&#xFF1A;xlabel&#x91CC;&#x7684; &quot;\pi&quot;&#xFF0C;&#x53CD;&#x659C;&#x6760;&#x4EE3;&#x8868;&#x8F6C;&#x4E49;&#xFF0C;\pi&#x8F6C;&#x4E49;&#x5C31;&#x662F;&#x7B26;&#x53F7;&#x3C0; &#x5566;&#xFF1B;ylabel&#x91CC;&#x7684;&quot;e^{-x}&quot;,&#x4EE3;&#x8868;e&#x7684;x&#x6B21;&#x65B9;&#xFF0C;&#x4E3A;&#x5565;&#x7528;&#x5927;&#x62EC;&#x53F7;&#xFF0C;&#x6211;&#x4E5F;&#x4E0D;&#x77E5;&#x9053;</p>
<hr>
<p><strong>&#x6DFB;&#x52A0;&#x6807;&#x6CE8;&#x53CA;&#x7BAD;&#x5934;</strong></p>
<p>&#x6709;&#x65F6;&#x516C;&#x5F0F;&#x5F88;&#x590D;&#x6742;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x5C31;&#x9700;&#x8981;&#x4F7F;&#x7528;LaTex&#x8BED;&#x6CD5;&#x4E86;&#xFF0C;&#x672C;gitbook&#x4E2D;&#x7684;&#x516C;&#x5F0F;&#x77E9;&#x9635;&#x5565;&#x7684;&#xFF0C;&#x4F7F;&#x7528;&#x7684;&#x4E5F;&#x662F;LaTex&#x8BED;&#x6CD5;&#xFF08;&#x7528;&#x7684;Mathjax&#xFF09;</p>
<p>&#x6B63;&#x5F0F;&#x8BBA;&#x6587;&#x4E2D;&#xFF0C;&#x4F1A;&#x8981;&#x6C42;&#x4F7F;&#x7528;LaTex&#x8BED;&#x6CD5;&#xFF0C;&#x6700;&#x597D;&#x5B66;&#x4E60;&#x4E00;&#x4E0B;</p>
<p><a href="01.html">&#x53C2;&#x8003;</a></p>
<p>&#x683C;&#x5F0F;&#xFF1A;</p>
<table>
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>text()</td>
<td>&#x6570;&#x5B66;&#x8868;&#x8FBE;&#x5F0F;</td>
</tr>
<tr>
<td>annotation()</td>
<td>&#x6807;&#x6CE8;&#x7BAD;&#x5934;&#x5565;&#x7684;</td>
</tr>
</tbody>
</table>
<p>&#x547D;&#x4EE4;&#xFF1A;</p>
<p>x = linspace(0,3); y = x.^2.<em>sin(x); plot(x,y);
line([2,2],[0,2^2</em>sin(2)]);
str = &apos;<script type="math/tex; "> \int_{0}^{2} x^2\sin(x) dx </script>&apos;;
text(0.25,2.5,str,&apos;Interpreter&apos;,&apos;latex&apos;);
annotation(&apos;arrow&apos;,&apos;X&apos;,[0.32,0.5],&apos;Y&apos;,[0.6,0.4]); </p>
<p>&#x6CE8;&#xFF1A;&#x5176;&#x4E2D;&quot;str = &apos;<script type="math/tex; "> \int_{0}^{2} x^2\sin(x) dx </script>&apos;;&quot; &#x8FD9;&#x4E00;&#x884C;<em>
</em>&#x5C31;&#x662F;LaTex&#x8BED;&#x6CD5;&#x4E86;&#xFF0C;&#x4F7F;&#x7528;<script type="math/tex; ">...</script>&#x6765;&#x754C;&#x5B9A;&#xFF0C;&quot;\int_{0}^{2}&quot; &#x662F;&#x79EF;&#x5206;&#x7B26;&#x53F7;&#xFF0C;&#x6807;&#x6CE8;&#x79EF;&#x5206;&#x4E0A;&#x4E0B;&#x9650;&#xFF0C;\ &#x4F9D;&#x65E7;&#x662F;&#x8F6C;&#x4E49;&#x7B26;&#x53F7;</p>
<p>text(0.25,2.5... &#x662F;&#x663E;&#x793A;&#x4F4D;&#x7F6E;
annotation(&apos;arrow&apos;...&#x662F;&#x6807;&#x6CE8;&#x7BAD;&#x5934;</p>
<p>&#x6CE8;&#xFF1A;6.5&#x4FBF;&#x643A;&#x7CBE;&#x7B80;&#x7248;&#x65E0;&#x6B64;&#x529F;&#x80FD;</p>
<hr>
<p>&#xFF08;&#x672A;&#x5B8C;&#x5F85;&#x7EED;&#xFF09;</p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="03.html" class="navigation navigation-prev " aria-label="Previous page: 结构化程式与自定函数">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="05.html" class="navigation navigation-next " aria-label="Next page: 数值微积分">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"基础绘图","level":"1.5","depth":1,"next":{"title":"数值微积分","level":"1.6","depth":1,"path":"05.md","ref":"05.md","articles":[]},"previous":{"title":"结构化程式与自定函数","level":"1.4","depth":1,"path":"03.md","ref":"03.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["splitter","mathjax"],"pluginsConfig":{"splitter":{},"mathjax":{"forceSVG":false,"version":"2.6-latest"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"04.md","mtime":"2019-03-30T14:55:28.447Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-03-30T15:35:37.254Z"},"basePath":".","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="gitbook/gitbook.js"></script>
    <script src="gitbook/theme.js"></script>
    
        
        <script src="gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="https://cdn.mathjax.org/mathjax/2.6-latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-mathjax/plugin.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

